﻿<UserControl x:Class="Microsoft.Research.Provenance.Controls.View.ActivityPerformanceView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="Auto" Width="Auto" AutomationProperties.Name="AIDActivityPerformanceView">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisibilty"/>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
					<RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="0" CornerRadius="5,5,0,0">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                            <GradientStop Color="#FFE8E8E8" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="40"/>
                        </Grid.ColumnDefinitions>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Path=ActivityLabel}" TextWrapping="Wrap" Margin="5,0,0,0" FontSize="13"/>
                            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text=" - Performance Information" TextWrapping="Wrap" Margin="0,0,0,0" FontSize="13"/>
                        </StackPanel>
					</Grid>
                </Border>
                <Border Grid.Row="2" Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=DoesNotContainItems}">
                    <TextBlock Margin="5,5,5,5" Text="No performance data available."/>
                </Border>
                <ListView 
                    IsSynchronizedWithCurrentItem="True" 
                    ItemsSource="{Binding Path=ActivityPerformanceIndicators}" 
                    ItemTemplate="{DynamicResource DataTemplate1}" 
                    Style="{DynamicResource ListViewStyle1}" 
                    ItemsPanel="{DynamicResource ItemsPanelTemplate1}" 
                    BorderBrush="#FFBFC3CA" Grid.RowSpan="2" Grid.Row="2" Margin="5,5,5,5" 
                    Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=ContainItems}">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Counter" DisplayMemberBinding="{Binding Path=PerformanceCounter}" />
                            <GridViewColumn Header="Average" DisplayMemberBinding="{Binding Path=Average}" />
                            <GridViewColumn Header="Minimum" DisplayMemberBinding="{Binding Path=Minimum}" />
                            <GridViewColumn Header="Maximum" DisplayMemberBinding="{Binding Path=Maximum}" />
                        </GridView>
                    </ListView.View>
                </ListView>
				<Border Grid.Row="1" Margin="5,5,5,5" HorizontalAlignment="Stretch" CornerRadius="5,5,5,5" BorderThickness="1,1,1,1" BorderBrush="#FFD0D0D0" Height="30" Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=IsBreadcrumbNull}" x:Name="breadcrumbBorder">
                	<TextBlock Width="Auto" Height="Auto" Text="{Binding Path = Breadcrumb}" TextWrapping="Wrap" Margin="2,2,2,2" x:Name="breadcrumbText"/>
                </Border>
            </Grid>
        </Border>
    </Grid>
   
</UserControl>
